package com.cmccgz.udacs_landlord_webapp.base;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cmccgz.baselibrary.utils.StringUtils;
import com.cmccgz.udacs_landlord_webapp.R;

public class EmptyViewHolder extends RecyclerView.ViewHolder {
    private final TextView tv_empty;

    public EmptyViewHolder(View itemView) {
        super(itemView);
        tv_empty = ((TextView) itemView.findViewById(R.id.tv_empty));
    }

    public static EmptyViewHolder defaultEmptyViewHolder(ViewGroup parent, String emptyTips) {
        if (parent == null)
            return null;
        EmptyViewHolder emptyViewHolder = new EmptyViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_empty, parent, false));
        emptyViewHolder.tv_empty.setText(StringUtils.isEmpty(emptyTips)?"暂无数据!":emptyTips);
        return emptyViewHolder;
    }
}
